//package com.artisan.provider.controller;
//
//import com.artisan.provider.dto.ZgUserDto;
//import com.artisan.provider.vo.RPage;
//import com.artisan.provider.vo.ZgUserPoVo;
//import com.artisan.provider.vo.ZgUserPoVos;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.cloud.client.ServiceInstance;
//import org.springframework.cloud.client.discovery.DiscoveryClient;
//import org.springframework.cloud.context.config.annotation.RefreshScope;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.client.RestTemplate;
//
//import java.util.List;
//
//@RestController
//@RefreshScope
////@DefaultProperties(defaultFallback = "fallback")
//public class UserController {
//
//    @Autowired
//    private RestTemplate restTemplate;
//
//    @Autowired
//    private DiscoveryClient discoveryClient;
//
//    //@HystrixCommand
//    @RequestMapping(value = "/getPro/user/list")
//    public RPage<ZgUserPoVos> getAll(){
////        String url = "http://localhost:18081/user/findAll";\
//        //获取实例列表
////        List<ServiceInstance> serviceInstances = discoveryClient.getInstances("provider");
////        //实例信息
////        ServiceInstance serviceInstance = serviceInstances.get(0);
//
//        String url = "http://provider/api/user/findAll/2/10";
//
//        ZgUserDto zgUserDto = new ZgUserDto();
//        //明天改RPage格式
//        //Object forObject = restTemplate.postForObject(url,zgUserDto, Object.class); //RPage<ZgUserPoVo>
//
//        //String url2 = "http://providerpro/user/findAll";
//
//        //String forObject2 = restTemplate.getForObject(url2, String.class);
//        //System.out.println(forObject);
//        return null;
//    }
//
//
//
//    /**
//     * 新建一个入口 api  等同于consumer 在配置........可以访问
//     * @return
//     */
//    //@HystrixCommand
//    @RequestMapping(value = "/getAll/user/list/login")
//    public String getAllLogin(){
////        String url = "http://localhost:18081/user/findAll";\
//        //获取实例列表
////        List<ServiceInstance> serviceInstances = discoveryClient.getInstances("provider");
////        //实例信息
////        ServiceInstance serviceInstance = serviceInstances.get(0);
//
//        String url = "http://providerpro/user/findAll";
//
//        String forObject = restTemplate.getForObject(url, String.class);
//        return forObject;
//    }
//
//
//
//    public String fallback(){
//        return "服务器繁忙，请稍后重试！";
//    }
//
//
//}
